/*
 * buttons.c
 *
 *  Created on: Feb 26, 2013
 *      Author: ostan
 */

#include <avr/io.h>

void Buttons_init(void) {
	DDRG &= ~((1<<DDG3) | (1<<DDG4)); // set PG3 PG4 as inputs
	PORTG |= (1<<PG3) | (1<<PG4); // set pull-up resistors for buttons
}

char isButtonPressed(int button) {
	switch(button) {
	case 0:
		return (PING & (1<<PING4)) ? 0 : 1;
		break;
	case 1:
		return (PING & (1<<PING3)) ? 0 : 1;
		break;
	default:
		return 0;
	}

}
